#ifndef __OPTIMIZER_H__
#define __OPTIMIZER_H__
// Code optimizer
// Input : ImmCodes (3 address code)
// Output : ImmCodes (3 address code)
class ImmCodes;

class CodeOptimizer {
public:
	CodeOptimizer() {}
	ImmCodes* optimize(ImmCodes* in);
	void foo() {cout << "shut" << endl;}

	ImmCodes* peephole_main(ImmCodes* in, bool* updatedin);
	void peephole_reorderJump(vector<ImmCode*>*, bool* updated=NULL);

	void peephole_removeJumpToNextAddr(vector<ImmCode*>* window, bool* updated=NULL);

	void peephole_removeConsecutiveGOTO(vector<ImmCode*>* window, bool* updated=NULL);
	void peephole_removeUselessLabel(vector<ImmCode*>* window, bool* updated=NULL);
	void peephole_removeRedundantArithmetic(vector<ImmCode*>* window, bool* updated=NULL);

protected:
};
#endif /*__OPTIMIZER_H__*/
